<!DOCTYPE html>
<html >
<head>
	<meta charset="utf-8"/>
	<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
	<meta name="viewport" content="width=device-width, initial-scale=1"/>
	<title>{title}</title>
	<link href="{style_dir}bootstrap/css/bootstrap.min.css" rel="stylesheet"/>
	<link rel="stylesheet" href="{style_dir}font-awesome/css/font-awesome.min.css"/>
	<link rel="stylesheet" href="images/style.css" />
	<link href="images/jquery.wizzy.css" rel="stylesheet">
	<link rel="icon" href="../favicon.ico" type="image/x-icon" />
	<link rel="shortcut icon" href="../favicon.ico" type="image/x-icon" />
	<script>
		var style_dir	= '{style_dir}';
	</script>
	<script src="{style_dir}js/global.js"></script>
</head>
<body>
<form action="" id="form" method="post">
	<div class="argument">
		<div class="container">
			<div class="col-md-12 col-sm-12 arg_bg">
				<div class="argument_title">
					<div class="pull-left arg_span">
						<span style="padding-right:10px;"><lang>FoundPHP FrameWork</lang></span><span style="border-left:solid 1px #fff;padding:0 0 0 10px;"><lang>安装向导</lang></span>
					</div>
					<div class="pull-right">
						<span><small>{FoundPHP_Ver}</small></span>
					</div>
					<div class="clearfix"></div>
				</div>
				<div class="step">
				<!-- Start Wizzy -->
				<div class="wz-wrapper wizzy">
					<div class="wz-inner">
						<div class="wz-header" style="height:60px;">
							<nav>
								<a href="#" style="font-size:18px;" class="step-title"><lang>导入数据中...</lang></a>
							</nav>
							<div class="progress progress-striped" style="height:20px;border-radius:0;margin-bottom: -10px;">
								<div class="progress-bar" role="progressbar"
									 aria-valuenow="60" aria-valuemin="0" aria-valuemax="100"
									 style="width: 0%;border-radius:0;">
									<span class="progress_span"></span>
								</div>
							</div>
						</div>

						<div class="wz-body">
							<div class="wz-step">
								<div class="install_db"></div>
							</div>


						</div>

					</div>

				</div>
				<!-- End Wizzy -->

				<div class="clearfix"></div>
				</div>
			</div>
			FoundPHP Framework ©2005-2021 Support PHP5, PHP7, PHP8 | <a href="http://www.foundphp.com" target="_blank">http://www.foundphp.com</a>
			<br><br>
		</div>
	</div>

</form>
</body>
<script src="images/jquery.wizzy.js"></script>
<script>
	$(".wizzy").wizzy();
	$("body").on("click", ".bb", function() {
		$('#form').submit();
	});
</script>
<script>
	$(function(){
		//禁止右击
		$(document).ready(function() {
			   $(document).bind("contextmenu",function(e) {
				error('抱歉，请不要刷新!');
				return false;
			   });
		});

		//禁止f5刷新
		 $(document).bind("keydown",function(e){
			e=window.event||e;
			if(e.keyCode==116){
				e.keyCode = 0;
				return false;
			}
		});
		//禁用浏览器前进后退
		if (window.history && window.history.pushState) {
			$(window).on('popstate', function () {
			//当点击浏览器的 后退和前进按钮 时才会被触发，
				window.history.pushState('forward', null, '');
				window.history.forward(1);
			});
		}
		window.history.pushState('forward', null, '');  //在IE中必须得有这两行
		window.history.forward(1);

	})
	
	var str_success	= '...<span style="color:blue"><lang>成功</lang></span>';
	var str_fail	= '...<span style="color:red"><lang>失败</lang></span>';
	//行滚动
	time	= setInterval('jump()',300);
	var i	= 0;
	function jump(){
		i++;
		$.ajax({
			type: "get",
			url: '?a=database&t=data',
			data:{
				'p':i,
			},
			success: function(msg){
				//滚动条设置
				progress		= i/msg.all*100;
				progress		= progress.toFixed(2);
				if(progress>100){
					progress	= 100;
				}
				$('.progress-bar').css('width',progress+'%');
				$('.progress_span').text(progress+'%');
				//滚动
				
				if(i==msg.all+1){
					
					if(msg.type==7){
						tip		=	'<span style="color:red"><lang>缓存目录失败</lang></span>';
						message	= '';
						$('.install_db').html('');
						$('.progress-bar').css('width','0%');
						$('.progress_span').text('安装失败');
					}
					if(msg.type==9){
						tip		=	'<lang>数据库安装完成</lang>';
						message	= '...';
					}
					$('.install_db').append('<div class="db_num">'+tip	+" "+msg.table+""+' '+ message+'</div>');
					$('.install_db').animate({ scrollTop: "+=50" }, 500);
					//清除Timeout的定时器
					clearTimeout(time);
					if (msg.type==7){
						return false;
					}
					setTimeout("location.href='index.php?a=finish'",1000);
				}else{
					if(msg.type==1){
						tip		=	'<lang>删除数据表</lang>';
						//判断是否出错
						if(msg.error==0){
							message	= str_success;
						}else{
							message	= str_fail;
						}

					}
					if(msg.type==2){
						tip		=	'<lang>建立数据表</lang>';
						//判断是否出错
						if(msg.error==0){
							message	= str_success;
						}else{
							message	= str_fail;
						}
					}
					if(msg.type==3){
						tip		=	'<lang>数据插入表</lang>';
						//判断是否出错
						if(msg.error==0){
							message	= str_success;
						}else{
							message	= str_fail;
						}
					}
					if(msg.type==4){
						tip		=	'<lang>更改表</lang>';
						//判断是否出错
						if(msg.error==0){
							message	= str_success;
						}else{
							message	= str_fail;
						}
					}
					if(msg.type==5){
						tip		=	'<lang>优化表</lang>';
						//判断是否出错
						if(msg.error==0){
							message	= str_success;
						}else{
							message	= str_fail;
						}
					}
					if(msg.type==9){
						tip		=	'<lang>安装检查...</lang>';
						message	= '安装检查...';
					}
					
					if(msg.type==0 && !msg.table){
						tip		= '';
						message	= '...';
					}
					$('.install_db').append('<div class="db_num">'+tip	+' '+msg.table+""+' '+ message+'</div>');
					if (msg.type==9){
						return false;
					}
					$('.install_db').animate({ scrollTop: "+=50" }, 500);
				}
			}

		})

	}
</script>

</html>